import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import {createHtmlPlugin} from 'vite-plugin-html'
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    createHtmlPlugin({
      inject: {
        data: {
          title: "CIM_Gis_UI"
        }
      }
    }),
    createSvgIconsPlugin({
      iconDirs: [path.resolve(process.cwd(), "src/icons")],
      // Specify symbolId format
      symbolId: "icon-[dir]-[name]"
      /**
       * custom insert position
       * @default: body-last
       */
      //  inject?: 'body-last' | 'body-first'

      /**
       * custom dom id
       * @default: __svg__icons__dom__
       */
      //  customDomId: '__svg__icons__dom__',
    })
  ],
  css: {
    preprocessorOptions: {
      scss: {}
    }
  },
  server:{
    port: 10288,
    open: true,
    proxy: {
      '/cimapi': {
        target: 'http://101.133.234.110:11202/',
        rewrite: path => path.replace(/^\/cimapi/, ''),
        changeOrigin: true,
      },
    },
  },
  build: {
    outDir: "dist",
    assetsDir: "assets"
  }
})
